<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * PHP versions 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 *
 * @category   output 
 * @package    DINAMIC
 * @author     Kanazawa Kazuyoshi <kazu.php@gmail.com>
 * @license     
 * @version    CVS: $Id: output.class.php 69 2008-02-17 10:22:54Z kazu.php $
 */

/**
 *
 * PHP versions 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category    
 * @package    DINAMIC
 * @author     Kanazawa Kazuyoshi <kazu.php@gmail.com>
 */
class output
{

    // {{{ properties

    public static 

    /**
     * output 
     * 
     * @static
     * @var     array
     * @access  public
     */
    $output = array(),

    /**
     * frozen 
     * 
     * @static
     * @var     array
     * @access  public
     */
    $frozen = array(),

    /**
     * debug 
     * 
     * @static
     * @var     array
     * @access  public
     */
    $debug = array();

    // }}}
    // {{{ __construct

    public function __construct()
    {
    }

    // }}}
    // {{{ freeze

    public static function freeze()
    {
        $key = uniqid();
        self::$frozen[$key] = self::$output;
        self::$output = array();
        return $key;
    }

    // }}}
    // {{{ melt

    public static function melt($key)
    {
        if (array_key_exists($key, self::$frozen)) {
            self::$output = self::$frozen[$key];
            unset(self::$frozen[$key]);
            return true;
        }
        return false;
    } 

    // }}}
    // {{{ dump 

    public static function dump()
    {
        var_export(self::$output);
    }

    // }}}
    // {{{ get
    public static function get()
    {
        return join('', self::$output);
    }

    // }}}
    // {{{ json 

    public static function json()
    {
        return json_encode(self::$output);
    }

    // }}}
    // {{{ add 

    /**
     * @return boolean
     */
    public static function add($string)
    {
        self::$output[] = $string;
        return true;
    }

    // }}}
    // {{{ clean

    public static function clean()
    {
        self::$output = array();
    }

    // }}}

}



?>
